package com.etc.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import com.etc.dao.FriendMapper;
import com.etc.entity.Friend;
import com.etc.service.FriendService;
import com.etc.util.PageData;

@Service
public class FriendServiceImpl implements FriendService {
	@Resource
	private FriendMapper fm;

	@Override
	public PageData<Friend> selectByPage(int page, int limit, String content, int userId) {
		int start = (page - 1) * limit;
		List<Friend> list = fm.selectByPage(start, limit, content, userId);
		int count = fm.selectCountByUserid(content, userId);
		PageData<Friend> pd = new PageData<>(list, count, limit, page);
		return pd;
	}

	@Override
	public boolean deleteByPrimaryKey(Integer friendId) {
		// TODO Auto-generated method stub
		return fm.deleteByPrimaryKey(friendId) > 0;
	}

}
